package com.atguigu.th.demo.controller;

import com.atguigu.th.demo.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @Date 2021/7/3 9:53
 * @Description TODO
 */
@Controller
public class HelloController {

    @GetMapping("test")
    public String test(Model model) {
        User user = new User("老王", 20, new User("柳岩", 20, null));
        model.addAttribute("msg", "hello---thymeleaf");
        model.addAttribute("user", user);
        List<User> users = Arrays.asList(
                new User("柳岩", 21, null),
                new User("锋哥", 22, null),
                new User("杨紫", 23, null),
                new User("小鹿", 24, null)
        );

        model.addAttribute("users", users);
        model.addAttribute("brandId", 2);
        model.addAttribute("pageNum", 1);
        model.addAttribute("pageSize", 10);
        model.addAttribute("ss", Arrays.asList("a", "b", "c", "d"));
        model.addAttribute("date", new Date());
        return "hello";
    }
}
